package com.tanhua.model.enums;

/**
 * @author Xiao
 * @date 2021/10/28
 */
public enum CommentType {
    LIKE(1), COMMENT(2), LOVE(3);

    Integer type;

    CommentType(int type) {
        this.type = type;
    }

    /**
     * 获取喜欢、评论、点赞对应的数字：1/2/3
     * @return type-->Integer
     */
    public int getType() {
        return type;
    }

    /**
     * 获取评论类型：LIKE/COMMENT/LOVE
     * @param key
     * @return object-->LIKE/COMMENT/LOVE
     */
    public static CommentType getByType(Integer key) {
        CommentType[] values = CommentType.values();
        for (CommentType object : values) {
            if (object.type.equals(key)) {
                return object;
            }
        }
        return null;
    }
}
